#ifdef HAVE_CONFIG_H
#  include <config.h>

#endif

#include <gtk/gtk.h>
#include "gestion_patient.h"
#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include <stdlib.h>
#include <string.h>





void on_button2_clicked(GtkWidget *objet_garphique,gpointer  user_data)
{
gtk_main_quit();

}


void on_button1_clicked (GtkWidget *objet_graphique,gpointer user_data)
{

        GtkWidget *entry1;
	GtkWidget *entry2;
        GtkWidget *window2;

        entry1 = lookup_widget(objet_graphique, "entry1");
	entry2 = lookup_widget(objet_graphique, "entry2");
      
        window2 = create_window2();
	gtk_widget_show(window2);

      
}


void on_button4_clicked(GtkWidget *objet_garphique,gpointer user_data)
{      GtkWidget *window3;

      window3 = create_window3();
	gtk_widget_show(window3);
}


void on_button5_clicked(GtkWidget *objet_graphique,gpointer user_data)
{
        GtkWidget *window7;

        window7 = create_window7();
	gtk_widget_show(window7);

}


void on_button3_clicked (GtkWidget  *objet_graphique, gpointer user_data)
{GtkWidget *window4;

      window4 = create_window4();
	gtk_widget_show(window4);

}


void
on_button11_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


gboolean
on_alignment1_button_press_event       (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data)
{

  return FALSE;
}


void on_button10_clicked(GtkWidget *objet_graphique,gpointer         user_data)
{           GtkWidget *window10; 
           window10 = create_window10();
	   gtk_widget_show(window10);


}


void
on_button9_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{

}


void on_button8_clicked  (GtkWidget  *objet_graphique,gpointer  user_data)
{         GtkWidget *window12; 
           window12 = create_window12();
	   gtk_widget_show(window12);

}


void on_button6_clicked(GtkWidget *objet_graphique,gpointer user_data)
{          
            GtkWidget *window8; 
           window8 = create_window8();
	   gtk_widget_show(window8);

}


void on_button7_clicked(GtkWidget *objet_graphique,gpointer user_data)
{         GtkWidget *window9; 
           window9 = create_window9();
	   gtk_widget_show(window9);


}


void
on_button14_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void
on_button12_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void
on_button13_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void
on_button15_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void
on_button16_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void
on_button19_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void
on_button18_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void on_button20_clicked (GtkWidget *objet_graphique, gpointer user_data)
{
       GtkWidget *entry7;

        entry7 = lookup_widget(objet_graphique, "entry7");
}


void
on_button21_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void on_button22_clicked (GtkWidget *objet_graphique,gpointer user_data)
{

         Patient p;
         
         FILE *fich_patient;

          GtkWidget *entry8;
	  GtkWidget *entry9;
          GtkWidget *entry10;
	  entry8 = lookup_widget(objet_graphique, "entry8");
	  entry9 = lookup_widget(objet_graphique, "entry9");
	  entry10 = lookup_widget(objet_graphique, "entry10");

          strcpy(p.prenom_patient, gtk_entry_get_text(GTK_ENTRY(entry10)));
	
	  strcpy(p.nom_patient, gtk_entry_get_text(GTK_ENTRY(entry9)));
	
	  p.id = atoi(gtk_entry_get_text(GTK_ENTRY(entry8)));

         saisir_patient(fich_patient,p);
}


void
on_button23_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void
on_button25_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void on_button24_clicked (GtkWidget       *objet_graphique, gpointer user_data)
{        int ident;
          FILE *fich_patient;
            char Buf0[100];
          GtkWidget * label30;
          label30= lookup_widget(objet_graphique, "label30");
          GtkWidget *entry11;
	  entry11 = lookup_widget(objet_graphique, "entry11");
          ident = atoi(gtk_entry_get_text(GTK_ENTRY(entry11)));
           supprimer_patient(fich_patient,ident);
            sprintf(Buf0,"Patient supprimé :)");
               gtk_label_set_text(GTK_LABEL(label30), Buf0);

}


void on_button26_clicked (GtkWidget *objet_graphique,gpointer user_data)
{ 
  char Buf[100];
 GtkWidget * label28;
 FILE *fich_patient;
 label28= lookup_widget(objet_graphique, "label28");
 sprintf(Buf,"initialisation terminé");
gtk_label_set_text(GTK_LABEL(label28), Buf);
   initialiser_patient(fich_patient);
}


void on_button27_clicked (GtkWidget  *objet_graphique,gpointer user_data)
{

}


void on_button28_clicked(GtkWidget *objet_graphique,gpointer user_data)
{              GtkWidget *window11; 
               window11 = create_window11();
	       gtk_widget_show(window11);

}


void on_button29_clicked (GtkWidget *objet_graphique,gpointer  user_data)
{
GtkWidget *entry12;

        entry12 = lookup_widget(objet_graphique, "entry12");
}


void on_button30_clicked  (GtkWidget *objet_graphique,gpointer user_data)
{
            GtkWidget *window13; 
               window13 = create_window13();
	       gtk_widget_show(window13);
}

